package com.zhiyou.crowdfunding.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhiyou.crowdfunding.bean.Admin;
import com.zhiyou.crowdfunding.mapper.AdminMapper;
import com.zhiyou.crowdfunding.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jyf
 * @since 2022-05-27
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Resource
    private AdminMapper adminMapper;


    @Override
    public Admin toLogin(Admin admin) {
        QueryWrapper<Admin> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("admin_name",admin.getAdminName());
        queryWrapper.eq("admin_password",admin.getAdminPassword());
        return adminMapper.selectOne(queryWrapper);
    }

    @Override
    public List<Admin> getAll() {
        return adminMapper.selectList(null);
    }
}
